﻿// (c) Copyright Michael Antonio.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved
using System;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Input;
using Subsonic.Data;
using MichMan.Utilities;
using MichMan.Utilities.Requests;
using System.Collections.Generic;

namespace Subsonic.ViewModels
{
    public class MainPivotViewModel : PivotViewModel
    {
        public MainPivotViewModel(string firstPivotId)
        {
            Id = firstPivotId;
        }

        public override IRequest LoadPivots()
        {
            List<BasePivotItemViewModel> pivots = new List<BasePivotItemViewModel>();
            pivots.Add(new MusicLibraryItemViewModel());
            pivots.Add(new AlbumListItemViewModel(AlbumListType.newest));
            pivots.Add(new AlbumListItemViewModel(AlbumListType.random));
            pivots.Add(new AlbumListItemViewModel(AlbumListType.highest));
            pivots.Add(new AlbumListItemViewModel(AlbumListType.recent));
            pivots.Add(new AlbumListItemViewModel(AlbumListType.frequent));

            if (Id != null)
            {
                pivots = pivots.Pivot(p => p.Id == this.Id).ToList();
            }

            foreach (var p in pivots)
            {
                this.Pivots.Add(p);
            }

            return null;
        }
    }
}
